package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteSmSendService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 业务模块降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteSmSendFallbackFactory implements FallbackFactory<RemoteSmSendService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSmSendFallbackFactory.class);

    @Override
    public RemoteSmSendService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteSmSendService()
        {
            @Override
            public AjaxResult vaildSm(String phone, String code) {
                return null;
            }

            @Override
            public AjaxResult ifAdmin(String code, String value) {
                return null;
            }
        };
    }
}
